 var shopid = getvl("shopid");
        $(function(){
  	if(shopid!=''){
  		   selectAlls();
  		  
  	}else{
  		alert("参数有误");
  	}
  	
  });
  var pageNos=1;
  var ss=0;
function selectAlls(){
	if(ss!=0 || pageNos==1)
	$.ajax({   
		url: urlcore + "/api/goods/selectList2?current="+pageNos+"&shopId="+shopid,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				ss=data.data.list.length;
				$.each(data.data.list, function(y,n) {
		var shangpingguanli=' <div class="clearfix tuwen sell_shangpin">'+
'    	<a href="javascript:void(0);">'+
'	        <div class="tuwen-img fl">'+
'	            <img onerror="errorImg(this)" src="'+n.coverUrl+'" width="75" height="75">'+
'	        </div>'+
'	        <div class="tuwen-wenzi">'+
'	            <h5 class="wuye_h01">'+n.goodsTitle+'</h5>'+
'	            <div class="wuye_div02">&yen;'+n.packPrice+'-&yen;'+n.tradePrice+'</div>'+
'	            <div class="clearfix sell_shangpin_xia">'+
'	            	已售出'+n.saleNum+'件&nbsp;&nbsp;'+n.lookTime+'次浏览'+
'	            </div>'+
'	            <div class="jinbi_shezhi" name="'+n.goldRate+'" id="'+n.id+'" >设置</div>'+
'                <span class='+n.id+'>'+n.goldRate+'</span>'+
'	        </div>'+
'        </a>'+
'    </div>';
          $("#shangpingguanli").append(shangpingguanli);
          
          
          //alert(n.goldRate)
          
				});
				
            $(function(){
            	 // 设置
    // 弹出
    $(".jinbi_shezhi").on('click',function(){
    	
    	 $("#wenben").val($(this).attr("name"));
    	 $("#wenbens").val($(this).attr("id"));
        $("body").append("<div id='mask'></div>");
        $(".jinbi_show").show();
    
    })
    //点击关闭
    $(".jinbi_hide").on('click',function(){
        $(".jinbi_show").hide();
        $("#mask").remove();
    }) 
            });
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
}


function queren(){
	     var kai=$("#wenbens").val();
	     var zhi=$("#wenben").val();
         	  	 $.ajax({  
        url : urlcore + "/api/goods/goodsupdataag",
        type : "post",  
        contentType: "application/json;charset=utf-8",
        data :  JSON.stringify({  //所在省市
        	    "id":kai,
        	   "goldRate":zhi
        	}),
        	dataType: "json",
        success: function(data) {//data是返回的hash,key之类的值，key是定义的文件名 
        	//alert("修改成功!");
        	
        window.location.href = window.location.href;
        },
        error:function(){  
            alert("修改失败");  
        }  
    });     
}




function jianhao(ts) {
	//alert(ts);
	var t = $(ts).next();
	if(t.val() != '' && t.val() > 0) {
		t.val(parseInt(t.val()) - 1);
		zhijin(t.val());
	} else {
		t.val(0);
	}
}

function jiahao(ts) {
	var t = $(ts).prev();
	if(parseInt(t.val()) < 20) {
		t.val(parseInt(t.val()) + 1);
	} else {
		t.val(20);
	}
}




function wenbenkuang(ts) {
	var shu = $(ts);
	var results = /^(10|[1-9])$/.test(shu.val()); //?"正":"非正";
	if(parseInt(shu.val()) > 20) {
		shu.val(20);
	} else if(parseInt(shu.val()) <= 0 || shu.val() == "") {
		shu.val(0);
	} else if(results == false) {
		shu.val(1);
	}
}

